package ua.vn.ticket_scanner.ui;

import android.view.View;
import android.view.animation.Animation;
import android.widget.RelativeLayout;

/**
 * Created by Ivan on 27.06.13.
 */
public class AnimationListener implements Animation.AnimationListener {

    private RelativeLayout mLayout;
    private Runnable mPostRunnable;

    public AnimationListener(RelativeLayout layout, Runnable postRunnable) {
        mLayout = layout;
        mPostRunnable = postRunnable;
    }

    @Override
    public void onAnimationStart(Animation animation) {
        if (mLayout != null)
            mLayout.setVisibility(View.VISIBLE);
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        if (mLayout != null)
            mLayout.setVisibility(View.GONE);
        if (mPostRunnable != null)
            mPostRunnable.run();
    }

    @Override
    public void onAnimationRepeat(Animation animation) {

    }
}
